#include "event2/event.h"
#include <stdio.h>

int main(){
    struct event_config* cfg;
    struct event_base* base;
    int i;
    /* My program wants to use edge-triggered events if at all possible. So
    I’ll try to get a base twice: Once insisting on edge-triggered IO, and
    once not.*/
    for (i=0; i<2; ++i) {
        cfg = event_config_new();
        /* I don’t like select.*/
        event_config_avoid_method(cfg, "select");
        if (i == 0)
            event_config_require_features(cfg, EV_FEATURE_ET);//要求支持边沿触发
        base = event_base_new_with_config(cfg);
        event_config_free(cfg);
        if (base)
            break;
        /* If we get here, event_base_new_with_config() returned NULL. If
        this is the first time around the loop, we’ll try again without
        setting EV_FEATURE_ET. If this is the second time around the
        loop, we’ll give up.
        */
    }

}